/*****************************************************************************
 * Please See the declaration in the bottom of this file.
 *
 *
 * Version			Date				Comment
 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * Init(0)			2007.10.29 
 *****************************************************************************/
#ifndef		__Microwire_H__
#define		__Microwire_H__



extern void SPIInit(unsigned char SPICtrl1, unsigned char SPICtrl2, unsigned char MSB_LSB);
extern void MW_TransmitData(unsigned char BitCount, unsigned char TxData);
extern void MWEE_ByteWrite(unsigned char Address, unsigned char WriteData);
extern void MWEE_WordWrite(unsigned char Address, unsigned int WriteData);
extern void MWEE_Erase(unsigned char Address);
extern void MWEE_ChkRdy(void);
extern void MWEE_EraseAll(void);
extern void MWEE_EWDisable(void);
extern void MWEE_EWEnable(void);

extern unsigned char MW_ReceiveData(unsigned char BitCount);
extern unsigned char MWEE_ByteRead(unsigned char Address);
extern unsigned int MWEE_WordRead(unsigned char Address);



//===============================
//DEFINITIONs
//===============================
#define		HIGH			1
#define		LOW			0
#define		MWEE_ChipSel		P1_0

#define		ERASE_OPCODE		0xE0		//11100000b, using MSB mode.
#define		ERASEALL_OPCODE		0x80		//10000000b, using MSB mode.
#define		EWDIS_OPCODE		0x80		//10000000b, using MSB mode.
#define		EWEN_OPCODE		0x80		//10000000b, using MSB mode.
#define		READ_OPCODE		0xC0		//11000000b, using MSB mode.
#define		WRITE_OPCODE		0xA0		//10100000b, using MSB mode.
#define		WRITEALL_OPCODE		0x80		//10000000b, using MSB mode.
#define		CHKRDY_OPCODE		0x00		//00000000b, using MSB mode.	// In order to send DI='0'



//===============================
//GLOBAL VARIABLES
//===============================
extern bit 		MWEE_Error;		// This bit is used to indicate if the read/write is successful.





#endif









/*****************************************************************************
 * Processor:	SM59R16A2
 * Compiler:	Keil C 2.0
 *
 * Company:	SyncMOS Technologies International,Inc.
 * Author:	Stanley Huang
 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 * Board:	64-pin demo board (SDB0001A-0)
 * Purpose:
 *
 *
 *****************************************************************************/


